package com.frank.threadPoolSave.service.impl;

import com.frank.jpaBatchSave.entity.User;
import com.frank.jpaBatchSave.repository.UserRepository;
import com.frank.threadPoolSave.service.MyAsyncService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;


@Service
@Slf4j
public class MyAsyncServiceImpl implements MyAsyncService {

    @Autowired
    private UserRepository repository;

    @Override
    @Async("asyncServiceExecutor")
    public void dataBaseToQueue(User user) {
        repository.save(user);
    }
}
